home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / batch / library / locate / locate.pas < prev    next >
Pascal/Delphi Source File  |  1991-03-09  |  1KB  |  46 lines

  1. PROGRAM Locate;
  2. {Written March 1991 by Andrew J. White.  See LOCATE.DOC for usage}
  3.  
  4. uses crt;
  5.  
  6. var X,Y,Code: Integer;
  7.  
  8. begin
  9.  
  10.   If ParamCount < 2 then              {Coordinates not specified, show usage}
  11.  
  12.     begin {if}
  13.       Writeln ('LOCATE v1.0 (c) 1991 by Andrew J. White: ß-test');
  14.       Writeln;
  15.       Writeln ('usage: ',ParamStr(0),' X Y');
  16.       Writeln ('       where X and Y are the cursor coordinates.');
  17.       Halt(1);                        {Exit and set error level to 1}
  18.     end; {if}
  19.  
  20.     Val(ParamStr(1),X,Code);          {Get X coordinate, put in X}
  21.  
  22.     Val(ParamStr(2),Y,Code);          {Get Y coordinate, put in Y}
  23.  
  24.     If (X<1) or (X>80) then           {Check X coordinate for validity}
  25.  
  26.       begin {if}
  27.         Writeln;
  28.         Writeln ('ERROR: Invalid X coordinate: ',X);
  29.         Halt(1);                      {Exit and set ErrorLevel to 1}
  30.       end; {if}
  31.  
  32.     If (Y<1) or (Y>25) then           {Check Y coordinate for validity}
  33.  
  34.       begin {if}
  35.         Writeln;
  36.         Writeln ('ERROR: Invalid Y coordinate: ',Y);
  37.         Halt(1);                      {Exit and set ErrorLevel to 1}
  38.       end; {if}
  39.  
  40.     GotoXY(X,Y);                       {Go to specified coordinate}
  41.  
  42.     Halt(0);                           {Exit with no error}
  43.  
  44. end.
  45.  
  46.